<%@page import="javax.xml.soap.Detail"%>
<%@page import="entity.Question"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="java.util.Locale"%>
<% 
	request.setCharacterEncoding("utf-8");
	response.setHeader("Content-Type","text/html; charset=utf-8");
	response.setHeader("Vary","Accept-Encoding");
	response.setCharacterEncoding("utf-8");
%>

<% 
	HttpSession ss = request.getSession(true);
	ResourceBundle resource = (ResourceBundle) ss.getAttribute("language");
	int currentPage = Integer.valueOf(request.getAttribute("currentPage").toString());
	String language = resource.getString("code");
%>
<%
	String title = resource.getString("page")+" "+(currentPage+1)+" - "+resource.getString("list_question");
	String description = title+resource.getString("description");
	String keywords = resource.getString("keyword");
	String tag = "question";
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="tag" value="<%=tag %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
	<jsp:param name="language" value="<%=language %>"/>
</jsp:include><div class="bd">
			<div class="bl">
				<jsp:include page="element/adv3.jsp"></jsp:include><br/><br/><br/>
				<h2><%=resource.getString("list_question") %></h2>
				<div class="adt">
					<!-- AddThis Button BEGIN -->
					<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
					<a class="addthis_button_preferred_1"></a>
					<a class="addthis_button_preferred_2"></a>
					<a class="addthis_button_preferred_3"></a>
					<a class="addthis_button_preferred_4"></a>
					<a class="addthis_button_compact"></a>
					<a class="addthis_counter addthis_bubble_style"></a>
					</div>
					<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
					<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d6f3cdb1d190d60"></script>
					<!-- AddThis Button END -->
				</div>
				<div class="adt so">
					<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
					<g:plusone size="standard" count="true"></g:plusone>
				</div>
				<div class="clear"></div>
				<ul class="lq">
				<%
					List<Question> listQuestion = (List<Question>)request.getAttribute("listQuestion"); 
					if(listQuestion.size()>0){
						for(Question item: listQuestion)
						{								
					%>
				<li>
					<h1>
						<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/question/<%=item.getAlias() %>" title="<%= item.getTitle()%>"><%=item.getTitle() %></a>
					</h1>
					<p>
						<%= item.getSubContent() %>
					</p> <%
						for(String tagItem: item.getTags()){
							%> 
								<%
									if(tagItem!=null){
										%>
											<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/tag/<%=tagItem%>"><%=tagItem%></a>											
										<%
									}
								%>								
							<% 
						}
					%>  
				</li>
				<% 								
						}
					}
				%>
				<li class="paginate">
					<%
						if(currentPage>0){
						%>							
							<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/list-questions/<%=currentPage-1%>">Previous</a>
						<%							
						}
					%>					
					<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/list-questions/<%=currentPage+1%>">Next</a>
				</li>
			</ul>
			</div>
			<div class="br">
				<jsp:include page="element/top_right.jsp"></jsp:include>
				<jsp:include page="element/tag.jsp">
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
				<jsp:include page="element/recent_view.jsp">
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
				<jsp:include page="element/random.jsp">
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
				<jsp:include page="element/new.jsp">
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
			</div>
			<div class="clear"></div>
		</div>
<jsp:include page="/layout/footer.jsp">
	<jsp:param name="language" value="<%=language %>"/>
</jsp:include>			